<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>update</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index_work.css">
</head>
<body>
<form action="${pageContext.request.contextPath}/employee" method="post">
    <input type="hidden" name="_method" value="put">
    <%--将用户id隐藏，没必要给用户展示--%>
    <input type="hidden" name="id" value="${requestScope.employee.id}">
    <table>
        <tr>
            <th colspan="2">Update Employee</th>
        </tr>
        <tr>
            <td>lastName</td>
            <td>
                <input type="text" name="lastName" value="${requestScope.employee.lastName}">
            </td>
        </tr>
        <tr>
            <td>email</td>
            <td>
                <input type="email" name="email" value="${requestScope.employee.email}">
            </td>
        </tr>
        <tr>
            <td>gender</td>
            <td>
                <input type="radio" name="gender" value="1" ${requestScope.employee.gender=="1"?"checked":""}>male
                <input type="radio" name="gender" value="0" ${requestScope.employee.gender=="0"?"checked":""}>female
            </td>
        </tr>
        <tr>
            <td>department</td>
            <td>
                <select name="department.id">
                    <c:forEach items="${requestScope.departments}" var="department">
                        <option value="${pageScope.department.id}" ${requestScope.employee.department.id==pageScope.department.id?"selected":""}>${pageScope.department.departmentName}</option>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="update">
            </td>
        </tr>
    </table>
</form>
</body>
</html>
